import 'package:card_swiper/card_swiper.dart';
import 'package:flutter/material.dart';

/// 推荐轮播
class RecommendSwiper extends StatelessWidget {
  const RecommendSwiper({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return SizedBox(
      width: double.infinity,
      height: 202,
      child: Swiper(
        itemBuilder: (context, index) {
          return SizedBox(
            width: double.infinity,
            height: 202,
            child: ColoredBox(color: Colors.primaries[index]),
          );
        },
        indicatorLayout: PageIndicatorLayout.COLOR,
        autoplay: true,
        // itemCount初始化数量必须大于0
        itemCount: 5,
        pagination: const SwiperPagination(
          builder: DotSwiperPaginationBuilder(),
        ),
      ),
    );
  }
}
